# Definition for a binary tree node.
# class TreeNode:
#     def __init__(self, x):
#         self.val = x
#         self.left = None
#         self.right = None

class Solution:
    def isSymmetric(self, root: TreeNode) -> bool:
        def mirror(node):
            if node is not None:
                node.left, node.right = mirror(node.right), mirror(node.left)
                return node
        
        def bfs(root):
            values = []
            if root:
                queue = [root]
                while queue:
                    node = queue.pop(0)
                    if node:
                        values.append(node.val)
                        queue.append(node.left)
                        queue.append(node.right)
                    else:
                        values.append(None)
            return values
        
        return bfs(root) == bfs(mirror(root))